<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <script>
        //1、可以实现数组的合并 代替之前的concat
        const arr1 = ['张三','李四','王五']
        const arr2 = ['老张','老李','老王']
        //合并两个数组
        const arr3 = [...arr1,...arr2]
        console.log(arr3); //['张三','李四','王五','老张','老李','老王']

        //2、数组的克隆
        const arr4 = ['hello','world','you']
        const arr5 = [...arr4]
        console.log(arr5);  //['hello','world','you']

        //3、将伪数组转换为真数组
        let divs = document.querySelectorAll('div');
        console.log(divs); //nodelist这个时候divs是伪数组
        //通过扩展运算符转化为数组
        const arr6 = [...divs];
        console.log(arr6);  //此时就是数组类型了，就可以使用数组的方法了

    </script>
</body>
</html>